/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Control;

import Boundary.Presensi;
//import java.s.Statement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author FaveGanteng
 */
public class LoginControl {
private Connection conn;

     LoginControl(Connection KoneksiDataBase) {
       this.conn =KoneksiDataBase;
    }

    public static LoginControl getKoneksi() throws SQLException {
        LoginControl kon = new LoginControl(Tools.DataBaseConnection.KoneksiDataBase());
        return kon;
    }

    public void InsertPresensi (Presensi p) throws SQLException {
        String nis =p.getNis().getUsername();
        String tgl = p.getTanggal();
        int kode = 0;
        kode = kode + p.getKodekehadiran();


        String query = "insert into " + " rpltpresensi "
                + "values ('" + nis + "','" + tgl
                + "'" + kode + "')";
        Statement stat = conn.createStatement();
        stat.executeUpdate(query);
    }
}
